package neu.soft.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import neu.soft.vo.ResultBean;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

@Component
@Slf4j
public class DispatchFeignClientFallBackFactory implements FallbackFactory<DispatchFeignClient> {
    @Override
    public DispatchFeignClient create(Throwable throwable) {
        return new DispatchFeignClient() {
            @Override
            public ResultBean<List<Map<String,Object>>>findTransfer(@RequestBody String orderId){
                log.info(throwable.getMessage());
                return ResultBean.error(500,throwable.getMessage());
            }
        };
    }

}
